function [Obj, Con] = CEC06_CSO_Func(x, problem, aaa)

ps = size(x, 1);

switch problem

    case 1

        g(:, 1) = 2 * x(:, 1) + 2 * x(:, 2) + x(:, 10) + x(:, 11) - 10;
        g(:, 2) = 2 * x(:, 1) + 2 * x(:, 3) + x(:, 10) + x(:, 12) - 10;
        g(:, 3) = 2 * x(:, 2) + 2 * x(:, 3) + x(:, 11) + x(:, 12) - 10;
        g(:, 4) = -8 * x(:, 1) + x(:, 10);
        g(:, 5) = -8 * x(:, 2) + x(:, 11);
        g(:, 6) = -8 * x(:, 3) + x(:, 12);
        g(:, 7) = -2 * x(:, 4) - x(:, 5) + x(:, 10);
        g(:, 8) = -2 * x(:, 6) - x(:, 7) + x(:, 11);
        g(:, 9) = -2 * x(:, 8) - x(:, 9) + x(:, 12);
        f = 5 * sum(x(:, 1:4), 2) - 5 * sum(x(:, 1:4).^2, 2) - sum(x(:, 5:13), 2);

    case 2

        g(:, 1) = 0.75 - prod(x, 2);
        g(:, 2) = sum(x')' - 7.5 * size(x, 2);
        f = -abs(sum((cos(x).^4), 2) - 2 * prod((cos(x).^2), 2)) ./ sqrt(1E-30 + sum(repmat(1:size(x, 2), ps, 1) .* (x.^2), 2));

    case 3

        g(:, 1) = abs(sum(x.^2, 2) - 1) - 0.0001;
        f =- (10.^0.5)^10 * prod(x, 2);

    case 4

        g(:, 1) =+ 85.334407 + 0.0056858 * x(:, 2) .* x(:, 5) + 0.0006262 * x(:, 1) .* x(:, 4) - 0.0022053 * x(:, 3) .* x(:, 5) - 92;
        g(:, 2) = -85.334407 - 0.0056858 * x(:, 2) .* x(:, 5) - 0.0006262 * x(:, 1) .* x(:, 4) + 0.0022053 * x(:, 3) .* x(:, 5);
        g(:, 3) =+ 80.51249 + 0.0071317 * x(:, 2) .* x(:, 5) + 0.0029955 * x(:, 1) .* x(:, 2) + 0.0021813 * x(:, 3).^2 - 110;
        g(:, 4) = -80.51249 - 0.0071317 * x(:, 2) .* x(:, 5) - 0.0029955 * x(:, 1) .* x(:, 2) - 0.0021813 * x(:, 3).^2 + 90;
        g(:, 5) =+ 9.300961 + 0.0047026 * x(:, 3) .* x(:, 5) + 0.0012547 * x(:, 1) .* x(:, 3) + 0.0019085 * x(:, 3) .* x(:, 4) - 25;
        g(:, 6) = -9.300961 - 0.0047026 * x(:, 3) .* x(:, 5) - 0.0012547 * x(:, 1) .* x(:, 3) - 0.0019085 * x(:, 3) .* x(:, 4) + 20;
        f = 5.3578547 * x(:, 3).^2 + 0.8356891 * x(:, 1) .* x(:, 5) + 37.293239 * x(:, 1) - 40792.141;

    case 5

        g(:, 1) = -x(:, 4) + x(:, 3) - 0.55;
        g(:, 2) = -x(:, 3) + x(:, 4) - 0.55;
        g(:, 3) = abs(1000 * sin(-x(:, 3) - 0.25) + 1000 * sin(-x(:, 4) - 0.25) + 894.8 - x(:, 1)) - 0.0001;
        g(:, 4) = abs(1000 * sin(x(:, 3) - 0.25) + 1000 * sin(x(:, 3) - x(:, 4) - 0.25) + 894.8 - x(:, 2)) - 0.0001;
        g(:, 5) = abs(1000 * sin(x(:, 4) - 0.25) + 1000 * sin(x(:, 4) - x(:, 3) - 0.25) + 1294.8) - 0.0001;
        f = 3 * x(:, 1) + 0.000001 * x(:, 1).^3 + 2 * x(:, 2) + 0.000002/3 * x(:, 2).^3;

    case 6

        g(:, 1) =- (x(:, 1) - 5).^2 - (x(:, 2) - 5).^2 + 100;
        g(:, 2) = (x(:, 1) - 6).^2 + (x(:, 2) - 5).^2 - 82.81;
        f = (x(:, 1) - 10).^3 + (x(:, 2) - 20).^3;

    case 7

        g(:, 1) = -105 + 4 * x(:, 1) + 5 * x(:, 2) - 3 * x(:, 7) + 9 * x(:, 8);
        g(:, 2) = 10 * x(:, 1) - 8 * x(:, 2) - 17 * x(:, 7) + 2 * x(:, 8);
        g(:, 3) = -8 * x(:, 1) + 2 * x(:, 2) + 5 * x(:, 9) - 2 * x(:, 10) - 12;
        g(:, 4) = 3 * (x(:, 1) - 2).^2 + 4 * (x(:, 2) - 3).^2 + 2 * x(:, 3).^2 - 7 * x(:, 4) - 120;
        g(:, 5) = 5 * x(:, 1).^2 + 8 * x(:, 2) + (x(:, 3) - 6).^2 - 2 * x(:, 4) - 40;
        g(:, 6) = x(:, 1).^2 + 2 * (x(:, 2) - 2).^2 - 2 * x(:, 1) .* x(:, 2) + 14 * x(:, 5) - 6 * x(:, 6);
        g(:, 7) = 0.5 * (x(:, 1) - 8).^2 + 2 * (x(:, 2) - 4).^2 + 3 * x(:, 5).^2 - x(:, 6) - 30;
        g(:, 8) = -3 * x(:, 1) + 6 * x(:, 2) + 12 * (x(:, 9) - 8).^2 - 7 * x(:, 10);
        f = x(:, 1).^2 + x(:, 2).^2 + x(:, 1) .* x(:, 2) - 14 * x(:, 1) - 16 * x(:, 2) + (x(:, 3) - 10).^2 + 4 * (x(:, 4) - 5).^2 + ...
            (x(:, 5) - 3).^2 + 2 * (x(:, 6) - 1).^2 + 5 * x(:, 7).^2 + 7 * (x(:, 8) - 11).^2 + 2 * (x(:, 9) - 10).^2 + (x(:, 10) - 7).^2 + 45;

    case 8

        g(:, 1) = x(:, 1).^2 - x(:, 2) + 1;
        g(:, 2) = 1 - x(:, 1) + (x(:, 2) - 4).^2;
        f =- (sin(2 * pi * x(:, 1)).^3) .* sin(2 * pi * x(:, 2)) ./ (x(:, 1).^3 .* (x(:, 1) + x(:, 2)) +1E-30);

    case 9

        g(:, 1) = -127 + 2 * x(:, 1).^2 + 3 * x(:, 2).^4 + x(:, 3) + 4 * x(:, 4).^2 + 5 * x(:, 5);
        g(:, 2) = -282 + 7 * x(:, 1) + 3 * x(:, 2) + 10 * x(:, 3).^2 + x(:, 4) - x(:, 5);
        g(:, 3) = -196 + 23 * x(:, 1) + x(:, 2).^2 + 6 * x(:, 6).^2 - 8 * x(:, 7);
        g(:, 4) = 4 * x(:, 1).^2 + x(:, 2).^2 - 3 * x(:, 1) .* x(:, 2) + 2 * x(:, 3).^2 + 5 * x(:, 6) - 11 * x(:, 7);
        f = (x(:, 1) - 10).^2 + 5 * (x(:, 2) - 12).^2 + x(:, 3).^4 + 3 * (x(:, 4) - 11).^2 + 10 * x(:, 5).^6 + ...
            7 * x(:, 6).^2 + x(:, 7).^4 - 4 * x(:, 6) .* x(:, 7) - 10 * x(:, 6) - 8 * x(:, 7);

    case 10

        g(:, 1) = -1 + 0.0025 * (x(:, 4) + x(:, 6));
        g(:, 2) = -1 + 0.0025 * (x(:, 5) + x(:, 7) - x(:, 4));
        g(:, 3) = -1 + 0.01 * (x(:, 8) - x(:, 5));
        g(:, 4) = -x(:, 1) .* x(:, 6) + 833.33252 * x(:, 4) + 100 * x(:, 1) - 83333.333;
        g(:, 5) = -x(:, 2) .* x(:, 7) + 1250 * x(:, 5) + x(:, 2) .* x(:, 4) - 1250 * x(:, 4);
        g(:, 6) = -x(:, 3) .* x(:, 8) + 1250000 + x(:, 3) .* x(:, 5) - 2500 * x(:, 5);
        f = x(:, 1) + x(:, 2) + x(:, 3);

    case 11

        g(:, 1) = abs(x(:, 2) - x(:, 1).^2) - 0.0001;
        f = x(:, 1).^2 + (x(:, 2) - 1).^2;

    case 12

        f =- (100 - (x(:, 1) - 5).^2 - (x(:, 2) - 5).^2 - (x(:, 3) - 5).^2) / 100;
        for j = 1:ps

            g(j, 1) = min(sum((repmat(x(j, :), 9 * 9 * 9, 1) - aaa).^2, 2)) - 0.0625;

        end

    case 13

        g(:, 1) = abs(x(:, 1).^2 + x(:, 2).^2 + x(:, 3).^2 + x(:, 4).^2 + x(:, 5).^2 - 10) - 0.0001;
        g(:, 2) = abs(x(:, 2) .* x(:, 3) - 5 * x(:, 4) .* x(:, 5)) - 0.0001;
        g(:, 3) = abs(x(:, 1).^3 + x(:, 2).^3 + 1) - 0.0001;
        f = exp(x(:, 1) .* x(:, 2) .* x(:, 3) .* x(:, 4) .* x(:, 5));

    case 14

        c = [-6.089 -17.164 -34.054 -5.914 -24.721 -14.986 -24.1 -10.708 -26.662 -22.179];
        g(:, 1) = abs(x(:, 1) + 2 * x(:, 2) + 2 * x(:, 3) + x(:, 6) + x(:, 10) - 2) - 0.0001;
        g(:, 2) = abs(x(:, 4) + 2 * x(:, 5) + x(:, 6) + x(:, 7) - 1) - 0.0001;
        g(:, 3) = abs(x(:, 3) + x(:, 7) + x(:, 8) + 2 * x(:, 9) + x(:, 10) - 1) - 0.0001;
        f = sum(x .* (repmat(c, ps, 1) + log(1E-30 + x ./ repmat(1E-30 + sum(x, 2), 1, 10))), 2);

    case 15

        g(:, 1) = abs(x(:, 1).^2 + x(:, 2).^2 + x(:, 3).^2 - 25) - 0.0001;
        g(:, 2) = abs(8 * x(:, 1) + 14 * x(:, 2) + 7 * x(:, 3) - 56) - 0.0001;
        f = 1000 - x(:, 1).^2 - 2 * x(:, 2).^2 - x(:, 3).^2 - x(:, 1) .* x(:, 2) - x(:, 1) .* x(:, 3);

    case 16

        y1 = x(:, 2) + x(:, 3) + 41.6;
        c1 = 0.024 * x(:, 4) - 4.62;
        y2 = 12.5 ./ c1 + 12;
        c2 = 0.0003535 * x(:, 1).^2 + 0.5311 * x(:, 1) + 0.08705 * y2 .* x(:, 1);
        c3 = 0.052 * x(:, 1) + 78 + 0.002377 * y2 .* x(:, 1);
        y3 = c2 ./ c3;
        y4 = 19 * y3;
        c4 = 0.04782 * (x(:, 1) - y3) + 0.1956 * (x(:, 1) - y3).^2 ./ x(:, 2) + 0.6376 * y4 + 1.594 * y3;
        c5 = 100 * x(:, 2);
        c6 = x(:, 1) - y3 - y4;
        c7 = 0.950 - c4 ./ c5;
        y5 = c6 .* c7;
        y6 = x(:, 1) - y5 - y4 - y3;
        c8 = (y5 + y4) * 0.995;
        y7 = c8 ./ y1;
        y8 = c8 / 3798;
        c9 = y7 - 0.0663 * y7 ./ y8 - 0.3153;
        y9 = 96.82 ./ c9 + 0.321 * y1;
        y10 = 1.29 * y5 + 1.258 * y4 + 2.29 * y3 + 1.71 * y6;
        y11 = 1.71 * x(:, 1) - 0.452 * y4 + 0.580 * y3;
        c10 = 12.3/752.3;
        c11 = 1.75 * y2 .* 0.995 .* x(:, 1);
        c12 = 0.995 * y10 + 1998.0;
        y12 = c10 * x(:, 1) + (c11 ./ c12);
        y13 = c12 - 1.75 * y2;
        y14 = 3623.0 + 64.4 * x(:, 2) + 58.4 * x(:, 3) + (146312.0 ./ (y9 + x(:, 5)));
        c13 = 0.995 * y10 + 60.8 * x(:, 2) + 48 * x(:, 4) - 0.1121 * y14 - 5095.0;
        y15 = y13 ./ c13;
        y16 = 148000.0 - 331000.0 * y15 + 40.0 * y13 - 61.0 .* y15 .* y13;
        c14 = 2324 * y10 - 28740000 * y2;
        y17 = 14130000 - 1328.0 * y10 - 531.0 * y11 + (c14 ./ c12);
        c15 = (y13 ./ y15) - (y13 / 0.52);
        c16 = 1.104 - 0.72 * y15;
        c17 = y9 + x(:, 5);

        g(:, 1) = 0.28/0.72 .* y5 - y4;
        g(:, 2) = x(:, 3) - 1.5 * x(:, 2);
        g(:, 3) = 3496 .* y2 ./ c12 - 21;
        g(:, 4) = 110.6 + y1 - 62212 ./ c17;
        g(:, 5) = 213.1 - y1;
        g(:, 6) = y1 - 405.23;
        g(:, 7) = 17.505 - y2;
        g(:, 8) = y2 - 1053.6667;
        g(:, 9) = 11.275 - y3;
        g(:, 10) = y3 - 35.03;
        g(:, 11) = 214.228 - y4;
        g(:, 12) = y4 - 665.585;
        g(:, 13) = 7.458 - y5;
        g(:, 14) = y5 - 584.463;
        g(:, 15) = 0.961 - y6;
        g(:, 16) = y6 - 265.916;
        g(:, 17) = 1.612 - y7;
        g(:, 18) = y7 - 7.046;
        g(:, 19) = 0.146 - y8;
        g(:, 20) = y8 - 0.222;
        g(:, 21) = 107.99 - y9;
        g(:, 22) = y9 - 273.366;
        g(:, 23) = 922.693 - y10;
        g(:, 24) = y10 - 1286.105;
        g(:, 25) = 926.832 - y11;
        g(:, 26) = y11 - 1444.046;
        g(:, 27) = 18.766 - y12;
        g(:, 28) = y12 - 537.141;
        g(:, 29) = 1072.163 - y13;
        g(:, 30) = y13 - 3247.039;
        g(:, 31) = 8961.448 - y14;
        g(:, 32) = y14 - 26844.086;
        g(:, 33) = 0.063 - y15;
        g(:, 34) = y15 - 0.386;
        g(:, 35) = 71084.33 - y16;
        g(:, 36) = -140000 + y16;
        g(:, 37) = 2802713 - y17;
        g(:, 38) = y17 - 12146108;
        f = 0.000117 * y14 + 0.1365 + 0.00002358 * y13 + 0.000001502 * y16 + 0.0321 * y12 ...
            + 0.004324 * y5 + 0.0001 * (c15 ./ c16) + 37.48 * (y2 ./ c12) - 0.0000005843 * y17;

    case 17

        g(:, 1) = abs(-x(:, 1) + 300 - x(:, 3) .* x(:, 4) ./ 131.078 .* cos(1.48477 - x(:, 6)) + 0.90798 .* x(:, 3).^2 ./ 131.078 .* cos(1.47588)) - 0.0001;
        g(:, 2) = abs(-x(:, 2) - x(:, 3) .* x(:, 4) ./ 131.078 .* cos(1.48477 + x(:, 6)) + 0.90798 .* x(:, 4).^2 ./ 131.078 .* cos(1.47588)) - 0.0001;
        g(:, 3) = abs(-x(:, 5) - x(:, 3) .* x(:, 4) ./ 131.078 .* sin(1.48477 + x(:, 6)) + 0.90798 .* x(:, 4).^2 ./ 131.078 .* sin(1.47588)) - 0.0001;
        g(:, 4) = abs(200 - x(:, 3) .* x(:, 4) ./ 131.078 .* sin(1.48477 - x(:, 6)) + 0.90798 .* x(:, 3).^2 ./ 131.078 .* sin(1.47588)) - 0.0001;
        f = 30 .* x(:, 1) .* (x(:, 1) < 300) + 31 .* x(:, 1) .* (x(:, 1) >= 300) + 28 .* x(:, 2) .* (x(:, 2) < 100) + 29 .* x(:, 2) .* (x(:, 2) >= 100 & x(:, 2) < 200) + 30 .* x(:, 2) .* (x(:, 2) >= 200 & x(:, 2) < 1000);

    case 18

        g(:, 1) = x(:, 3).^2 + x(:, 4).^2 - 1;
        g(:, 2) = x(:, 9).^2 - 1;
        g(:, 3) = x(:, 5).^2 + x(:, 6).^2 - 1;
        g(:, 4) = x(:, 1).^2 + (x(:, 2) - x(:, 9)).^2 - 1;
        g(:, 5) = (x(:, 1) - x(:, 5)).^2 + (x(:, 2) - x(:, 6)).^2 - 1;
        g(:, 6) = (x(:, 1) - x(:, 7)).^2 + (x(:, 2) - x(:, 8)).^2 - 1;
        g(:, 7) = (x(:, 3) - x(:, 5)).^2 + (x(:, 4) - x(:, 6)).^2 - 1;
        g(:, 8) = (x(:, 3) - x(:, 7)).^2 + (x(:, 4) - x(:, 8)).^2 - 1;
        g(:, 9) = x(:, 7).^2 + (x(:, 8) - x(:, 9)).^2 - 1;
        g(:, 10) = x(:, 2) .* x(:, 3) - x(:, 1) .* x(:, 4);
        g(:, 11) = -x(:, 3) .* x(:, 9);
        g(:, 12) = x(:, 5) .* x(:, 9);
        g(:, 13) = x(:, 6) .* x(:, 7) - x(:, 5) .* x(:, 8);
        f = -0.5 * (x(:, 1) .* x(:, 4) - x(:, 2) .* x(:, 3) + x(:, 3) .* x(:, 9) - x(:, 5) .* x(:, 9) + x(:, 5) .* x(:, 8) - x(:, 6) .* x(:, 7));

    case 19

        a = [-16 2 0 1 0;
            0 -2 0 0.4 2;
            -3.5 0 2 0 0;
            0 -2 0 -4 -1;
            0 -9 -2 1 -2.8;
            2 0 -4 0 0;
            -1 -1 -1 -1 -1;
            -1 -2 -3 -2 -1;
            1 2 3 4 5;
            1 1 1 1 1];
        b = [-40 -2 -0.25 -4 -4 -1 -40 -60 5 1];
        c = [30 -20 -10 32 -10;
            -20 39 -6 -31 32;
            -10 -6 10 -6 -10;
            32 -31 -6 39 -20;
            -10 32 -10 -20 30];
        d = [4 8 10 6 2];
        e = [-15 -27 -36 -18 -12];
        g(:, 1) = -2 * sum(repmat(c(1:5, 1)', ps, 1) .* x(:, 11:15), 2) - 3 * d(1) .* x(:, 11).^2 - e(1) + sum(repmat(a(1:10, 1)', ps, 1) .* x(:, 1:10), 2);
        g(:, 2) = -2 * sum(repmat(c(1:5, 2)', ps, 1) .* x(:, 11:15), 2) - 3 * d(2) .* x(:, 12).^2 - e(2) + sum(repmat(a(1:10, 2)', ps, 1) .* x(:, 1:10), 2);
        g(:, 3) = -2 * sum(repmat(c(1:5, 3)', ps, 1) .* x(:, 11:15), 2) - 3 * d(3) .* x(:, 13).^2 - e(3) + sum(repmat(a(1:10, 3)', ps, 1) .* x(:, 1:10), 2);
        g(:, 4) = -2 * sum(repmat(c(1:5, 4)', ps, 1) .* x(:, 11:15), 2) - 3 * d(4) .* x(:, 14).^2 - e(4) + sum(repmat(a(1:10, 4)', ps, 1) .* x(:, 1:10), 2);
        g(:, 5) = -2 * sum(repmat(c(1:5, 5)', ps, 1) .* x(:, 11:15), 2) - 3 * d(5) .* x(:, 15).^2 - e(5) + sum(repmat(a(1:10, 5)', ps, 1) .* x(:, 1:10), 2);
        f = sum(repmat(c(1:5, 1)', ps, 1) .* x(:, 11:15), 2) .* x(:, 11) + sum(repmat(c(1:5, 2)', ps, 1) .* x(:, 11:15), 2) .* x(:, 12) ...
            + sum(repmat(c(1:5, 3)', ps, 1) .* x(:, 11:15), 2) .* x(:, 13) + sum(repmat(c(1:5, 4)', ps, 1) .* x(:, 11:15), 2) .* x(:, 14) ...
            + sum(repmat(c(1:5, 5)', ps, 1) .* x(:, 11:15), 2) .* x(:, 15) + 2 * sum(repmat(d, ps, 1) .* x(:, 11:15).^3, 2) ...
            - sum(repmat(b, ps, 1) .* x(:, 1:10), 2);

    case 20

        a = [0.0693 0.0577 0.05 0.2 0.26 0.55 0.06 0.1 0.12 0.18 0.1 0.09 ...
                0.0693 0.0577 0.05 0.2 0.26 0.55 0.06 0.1 0.12 0.18 0.1 0.09];
        b = [44.094 58.12 58.12 137.4 120.9 170.9 62.501 84.94 133.425 82.507 46.07 60.097 ...
                44.094 58.12 58.12 137.4 120.9 170.9 62.501 84.94 133.425 82.507 46.07 60.079];
        c = [123.7 31.7 45.7 14.7 84.7 27.7 49.7 7.1 2.1 17.7 0.85 0.64];
        d = [31.244 36.12 34.784 92.7 82.7 91.6 56.708 82.7 80.8 64.517 49.4 49.1];
        e = [0.1 0.3 0.4 0.3 0.6 0.3];
        g(:, 1) = (x(:, 1) + x(:, 13)) ./ (sum(x, 2) + e(1));
        g(:, 2) = (x(:, 2) + x(:, 14)) ./ (sum(x, 2) + e(2));
        g(:, 3) = (x(:, 3) + x(:, 15)) ./ (sum(x, 2) + e(3));
        g(:, 4) = (x(:, 7) + x(:, 19)) ./ (sum(x, 2) + e(4));
        g(:, 5) = (x(:, 8) + x(:, 20)) ./ (sum(x, 2) + e(5));
        g(:, 6) = (x(:, 9) + x(:, 21)) ./ (sum(x, 2) + e(6));
        g(:, 7) = abs(x(:, 13) ./ (b(13) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(1) * x(:, 1) ./ (40 * b(1) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 8) = abs(x(:, 14) ./ (b(14) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(2) * x(:, 2) ./ (40 * b(2) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 9) = abs(x(:, 15) ./ (b(15) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(3) * x(:, 3) ./ (40 * b(3) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 10) = abs(x(:, 16) ./ (b(16) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(4) * x(:, 4) ./ (40 * b(4) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 11) = abs(x(:, 17) ./ (b(17) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(5) * x(:, 5) ./ (40 * b(5) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 12) = abs(x(:, 18) ./ (b(18) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(6) * x(:, 6) ./ (40 * b(6) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 13) = abs(x(:, 19) ./ (b(19) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(7) * x(:, 7) ./ (40 * b(7) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 14) = abs(x(:, 20) ./ (b(20) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(8) * x(:, 8) ./ (40 * b(8) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 15) = abs(x(:, 21) ./ (b(21) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(9) * x(:, 9) ./ (40 * b(9) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 16) = abs(x(:, 22) ./ (b(22) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(10) * x(:, 10) ./ (40 * b(10) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 17) = abs(x(:, 23) ./ (b(23) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(11) * x(:, 11) ./ (40 * b(11) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 18) = abs(x(:, 24) ./ (b(24) * (sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2))) - c(12) * x(:, 12) ./ (40 * b(12) * (sum(x(:, 1:12) ./ repmat(b(1:12), ps, 1), 2)))) - 0.0001;
        g(:, 19) = abs(sum(x, 2) - 1) - 0.0001;
        g(:, 20) = abs(sum(x(:, 1:12) ./ repmat(d(1:12), ps, 1), 2) + 0.7302 * 530 * 14.7/40 * sum(x(:, 13:24) ./ repmat(b(13:24), ps, 1), 2) - 1.671) - 0.0001;
        f = sum(repmat(a, ps, 1) .* x, 2);

    case 21

        g(:, 1) = -x(:, 1) + 35 * x(:, 2).^0.6 + 35 * x(:, 3).^0.6;
        g(:, 2) = abs(-300 * x(:, 3) + 7500 * x(:, 5) - 7500 * x(:, 6) - 25 * x(:, 4) .* x(:, 5) + 25 * x(:, 4) .* x(:, 6) + x(:, 3) .* x(:, 4)) - 0.0001;
        g(:, 3) = abs(100 * x(:, 2) + 155.365 * x(:, 4) + 2500 * x(:, 7) - x(:, 2) .* x(:, 4) - 25 * x(:, 4) .* x(:, 7) - 15536.5) - 0.0001;
        g(:, 4) = abs(-x(:, 5) + log(- x(:, 4) + 900)) - 0.0001;
        g(:, 5) = abs(-x(:, 6) + log(x(:, 4) + 300)) - 0.0001;
        g(:, 6) = abs(-x(:, 7) + log(-2 * x(:, 4) + 700)) - 0.0001;
        f = x(:, 1);

    case 22

        g(:, 1) = -x(:, 1) + x(:, 2).^0.6 + x(:, 3).^0.6 + x(:, 4).^0.6;
        g(:, 2) = abs(x(:, 5) - 100000 * x(:, 8) + 10^7) - 0.0001;
        g(:, 3) = abs(x(:, 6) + 100000 * x(:, 8) - 100000 * x(:, 9)) - 0.0001;
        g(:, 4) = abs(x(:, 7) + 100000 * x(:, 9) - 5 * 10^7) - 0.0001;
        g(:, 5) = abs(x(:, 5) + 100000 * x(:, 10) - 3.3 * 10^7) - 0.0001;
        g(:, 6) = abs(x(:, 6) + 100000 * x(:, 11) - 4.4 * 10^7) - 0.0001;
        g(:, 7) = abs(x(:, 7) + 100000 * x(:, 12) - 6.6 * 10^7) - 0.0001;
        g(:, 8) = abs(x(:, 5) - 120 * x(:, 2) .* x(:, 13)) - 0.0001;
        g(:, 9) = abs(x(:, 6) - 80 * x(:, 3) .* x(:, 14)) - 0.0001;
        g(:, 10) = abs(x(:, 7) - 40 * x(:, 4) .* x(:, 15)) - 0.0001;
        g(:, 11) = abs(x(:, 8) - x(:, 11) + x(:, 16)) - 0.0001;
        g(:, 12) = abs(x(:, 9) - x(:, 12) + x(:, 17)) - 0.0001;
        g(:, 13) = abs(-x(:, 18) + log(x(:, 10) - 100)) - 0.0001;
        g(:, 14) = abs(-x(:, 19) + log(- x(:, 8) + 300)) - 0.0001;
        g(:, 15) = abs(-x(:, 20) + log(x(:, 16))) - 0.0001;
        g(:, 16) = abs(-x(:, 21) + log(- x(:, 9) + 400)) - 0.0001;
        g(:, 17) = abs(-x(:, 22) + log(x(:, 17))) - 0.0001;
        g(:, 18) = abs(-x(:, 8) - x(:, 10) + x(:, 13) .* x(:, 18) - x(:, 13) .* x(:, 19) + 400) - 0.0001;
        g(:, 19) = abs(x(:, 8) - x(:, 9) - x(:, 11) + x(:, 14) .* x(:, 20) - x(:, 14) .* x(:, 21) + 400) - 0.0001;
        g(:, 20) = abs(x(:, 9) - x(:, 12) - 4.60517 * x(:, 15) + x(:, 15) .* x(:, 22) + 100) - 0.0001;
        f = x(:, 1);

    case 23

        g(:, 1) = x(:, 9) .* x(:, 3) + 0.02 .* x(:, 6) - 0.025 .* x(:, 5);
        g(:, 2) = x(:, 9) .* x(:, 4) + 0.02 .* x(:, 7) - 0.015 .* x(:, 8);
        g(:, 3) = abs(x(:, 1) + x(:, 2) - x(:, 3) - x(:, 4)) - 0.0001;
        g(:, 4) = abs(0.03 .* x(:, 1) + 0.01 .* x(:, 2) - x(:, 9) .* (x(:, 3) + x(:, 4))) - 0.0001;
        g(:, 5) = abs(x(:, 3) + x(:, 6) - x(:, 5)) - 0.0001;
        g(:, 6) = abs(x(:, 4) + x(:, 7) - x(:, 8)) - 0.0001;
        f = -9 .* x(:, 5) - 15 .* x(:, 8) + 6 .* x(:, 1) + 16 .* x(:, 2) + 10 .* (x(:, 6) + x(:, 7));

    case 24

        g(:, 1) = -2 * x(:, 1).^4 + 8 * x(:, 1).^3 - 8 * x(:, 1).^2 + x(:, 2) - 2;
        g(:, 2) = -4 * x(:, 1).^4 + 32 * x(:, 1).^3 - 88 * x(:, 1).^2 + 96 * x(:, 1) + x(:, 2) - 36;
        f = -x(:, 1) - x(:, 2);

end

Obj = f;
g(g < 0) = 0;
Con = g;
Con(isnan(Con)) = Inf;
end
